﻿package com.gengine.utils
{
    import flash.system.*;

    public class FlashVersion extends Object
    {
        private var _mainVersion:int;
        private var _secondVersion:int;
        public static const instance:FlashVersion = new FlashVersion;

        public function FlashVersion()
        {
            this.initVersion();
            return;
        }// end function

        public function get secondVersion() : int
        {
            return this._secondVersion;
        }// end function

        public function get mainVersion() : int
        {
            return this._mainVersion;
        }// end function

        public function getVersionStr() : String
        {
            return this._mainVersion + "." + this._secondVersion;
        }// end function

        public function isVersionMeet(param1:int, param2:int) : Boolean
        {
            return this._mainVersion > param1 || this._mainVersion == param1 && this._secondVersion >= param2;
        }// end function

        private function initVersion() : void
        {
            var _loc_3:Array = null;
            var _loc_1:* = Capabilities.version;
            var _loc_2:* = _loc_1.search(/\d""\d/);
            if (_loc_2 != -1)
            {
                _loc_1 = _loc_1.substr(_loc_2);
                _loc_3 = _loc_1.split(",");
                if (_loc_3.length == 4)
                {
                    this._mainVersion = int(_loc_3[0]);
                    this._secondVersion = int(_loc_3[1]);
                }
            }
            return;
        }// end function

    }
}
